package com.block.account.factory;

import com.block.account.enums.AccountTypeEnum;
import com.block.account.service.IAccountBillInfoService;
import com.block.account.service.accountbill.AccountItemProductBillInfoServiceImpl;
import com.block.common.util.ApplicationContextUtil;

import java.util.HashMap;
import java.util.Map;

public class AccountBillFactory {

    private static Map<String, Class<? extends IAccountBillInfoService>> serviceMap = new HashMap<>();
    static {
        serviceMap.put(AccountTypeEnum.PROD.getValue(), AccountItemProductBillInfoServiceImpl.class);
    }

    public static IAccountBillInfoService getService(String type){
        if (serviceMap.containsKey(type)){
            Class<? extends IAccountBillInfoService> aClass = serviceMap.get(type);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }

}
